package com.atomikos1.service;

import com.atomikos1.mapper.dao1.MikosMapper1;
import com.atomikos1.mapper.dao2.MikosMapper2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: LCG
 * 作者: LCG
 * 日期: 2021/3/24  14:13
 * 描述:
 */
@Component
public class TestService {

    @Autowired
    private MikosMapper1 mikosMapper1;

    @Autowired
    private MikosMapper2 mikosMapper2;

    @Transactional(rollbackFor = Exception.class,transactionManager = "transactionManager")
    public void test201101(){

        Map<String,Object> map=new HashMap<>();
        map.put("quantity",10);
        map.put("id",3);
        int i1 = mikosMapper1.update1St1(map);
        int i2 = mikosMapper2.update2Order(map);

        if(i1==1){
            throw new RuntimeException("==manger6====error  please  help======");
        }

    }

}
